home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / WORDMISC / BANNER.LZH / FCD.ASM < prev    next >
Assembly Source File  |  1986-09-06  |  25KB  |  844 lines

  1. COMMENT ;
  2.  
  3.     FCD.ASM The assembly language routines for FONTCODE.BAS
  4.     version 2.1, a tool for use with fonts used with the
  5.         banner program FONTSY.  Assemble this with MASM version
  6.     4.0 and link with FONTCODE.OBJ using the /E (exepack)
  7.     switch.  The main program is written for the
  8.     Microsoft QuickBASIC compiler version 2.0.
  9.  
  10. ;
  11. DATA        SEGMENT    BYTE    PUBLIC    'DATA'
  12.  
  13. ;-----------------------------------------------------------------------------
  14. NO    EQU    0
  15. YES    EQU    NOT NO
  16.  
  17. ;Set to YES if you are going to use a snowy color card
  18.  
  19. NoSnow        EQU    YES
  20.  
  21. ;-----------------------------------------------------------------------------
  22. ; 0 BLACK    4 RED          8 GRAY        12 LIGHT RED
  23. ; 1 BLUE    5 MAGENTA     9 LIGHT BLUE    13 LIGHT MAGENTA
  24. ; 2 GREEN    6 BROWN         10 LIGHT GREEN    14 YELLOW
  25. ; 3 CYAN    7 WHITE         11 LIGHT CYAN    15 HIGH-INTENSITY WHITE
  26.  
  27. ;                    Location Used
  28. CyanOnBlack    EQU    0BH        ;abort, hold option 1 prompt
  29. GreenOnBlack    EQU    0AH        ;most text
  30. RedOnBlack    EQU    0CH        ;error messages
  31. CyanOnGreen    EQU    2BH        ;option 2 title
  32. CyanOnRed    EQU    4BH        ;setdef4 title
  33. CyanOnMagenta    EQU    5BH        ;setdef7 title
  34. YellowOnBlue    EQU    1EH        ;program title
  35. YellowOnCyan    EQU    3EH        ;option 3 title
  36. YellowOnRed    EQU    4EH        ;option 4 title
  37. YellowOnMagenta    EQU    5EH        ;option 5 title
  38. YellowOnBrown    EQU    6EH        ;option 6 title
  39. WhiteOnBlue    EQU    1FH        ;setdef1 title
  40. WhiteOnGreen    EQU    2FH        ;setdef2 title
  41. WhiteOnCyan    EQU    3FH        ;setdef3 title
  42. WhiteOnRed    EQU    4FH        ;Loading Font, setdef4 title
  43. WhiteOnMagenta    EQU    5FH        ;setdef5 title
  44. WhiteOnBrown    EQU    6FH        ;setdef6 title
  45.  
  46. MonoSegAddr    EQU    0B000H        ;address of monochrome buffer
  47. GraphSegAddr    EQU    0B800H        ;address of graphics buffer
  48. ;-----------------------------------------------------------------------------
  49. TitleDat    DB    ' ╔',76 DUP (205),'╗ '
  50.         DB    ' ║      FONTCODE  version 2.1     9/6/86   (C) 1985,'
  51.         DB    ' 1986 Merlin R. Null      ║ '
  52.         DB    ' ╚',76 DUP (205),'╝ ',0
  53.  
  54. MenuText    DB    'The current font is:',30,30,1
  55.         DB    'Title:',31,31,1,1,1,1,1,1,1,21
  56.         DB    '1. Load an existing font (encoded)',30,16
  57.                DB    '2. Load a full set of font characters (text)',30,6
  58.         DB    '3. Open a new font',30,30,2
  59.         DB    '4. Load a single font character (text)',30,12
  60.         DB    '5. Unload a single character from the current font'
  61.         DB    30
  62.         DB    '6. Unload all of the current font to text files'
  63.         DB    30,3
  64.         DB    '7. Save the current font',30,26
  65.         DB    '8. Change font defaults',30,27
  66.         DB    '9. Modify font text files (menu #2)',30,6,1
  67.         DB    'Option (1-9) or <Esc> to exit ?',0
  68.  
  69. DescText    DB    'Encodes or decodes font data files used with the'
  70.         DB    ' FONTSY banner printer',0
  71.  
  72. AvailText    DB    'Characters included in this font are:',0
  73.  
  74. FrameDat    DB    ' ╔',31 DUP (205),'╗ ',30,15
  75.         DB    ' ║ ',29,' ║ ',30,15
  76.         DB    ' ╚',31 DUP (205),'╝ ',0
  77.  
  78. Opt1Text    DB    'Encoded font to load ?',0
  79.  
  80. Opt1aText       DB    ' ╔',18 DUP (205),'╗ ',30,28
  81.         DB    ' ║   Loading Font   ║ ',30,28
  82.         DB    ' ╚',18 DUP (205),'╝ ',0
  83.  
  84. Opt2Text    DB    'Font to encode ?',0
  85.  
  86. Opt2Title    DB    ' ╔',48 DUP (205),'╗ ',28
  87.         DB    ' ║  Loading a full set of font characters (text)  ║ '
  88.         DB    28
  89.         DB    ' ╚',48 DUP (205),'╝ ',0
  90.  
  91. Opt2aText    DB    'Go take a break, this will take a while',23,1,30
  92.         DB    '<Esc> to Abort',30,1,1,1,26
  93.         DB    'Working on',0
  94.  
  95. Opt3Title    DB    '       Open a New Font       ',0
  96.  
  97. Opt3Text    DB    'Enter the file name of your font.  If no extension '
  98.         DB    'is specified,',16,1
  99.         DB    'the default of FNT will be used.  A path may be '
  100.         DB    'included.',30,4,1,1
  101.         DB    'A bare <Return> exits to the main menu.',20,1,1,25
  102.         DB    'Example:  B:\source\BRILLIG.FNT',26,1,1,1,1,1,1
  103.         DB    'Font Name ?',0
  104.  
  105. Opt4Title    DB    'Load a single font character ',0
  106.  
  107. Opt4Text    DB    'Enter with a single keystroke the character file'
  108.         DB    ' you wish to load',30,1,3
  109.         DB    '<Esc> to return to the main menu',0
  110.  
  111. Opt5Title    DB    '  Unload a single character  ',0
  112.  
  113. Opt5Text    DB    'To unload a single character to a text file from '
  114.         DB    'the current font',15
  115.         DB    'enter with a single keystroke, the character you '
  116.         DB    'want decoded.',1,31
  117.         DB    'Press <Esc> to return to the main menu',0
  118.  
  119. Opt6Title    DB    ' Unload all of current font  ',0
  120.  
  121. Opt6Text    DB    'Current font is:',30,1,18
  122.         DB    'This will take a while and use a lot of disk space. '
  123.         DB    ' For a full',17
  124.         DB    'font you will need from 100k to over 200k of free '
  125.         DB    'disk space',20
  126.         DB    'and a free directory entry for each character of the'
  127.         DB    ' font.',22,1,1
  128.         DB    '1  Toggle height       is:',24,30,1
  129.         DB    '2  Toggle width        is:',24,30,1
  130.         DB    '<Esc> Return to main menu',25,30,1
  131.         DB    '<Return> to create text files',13,30,1,1,1,1
  132.         DB    'Option or <Return> to continue ?',0
  133.  
  134.  
  135. Opt6aText    DB    'Output font is:',31,1,1,31,8
  136.         DB    '<Esc> to abort',31,1,1,1,29
  137.         DB    'Unloading character:',0
  138.  
  139. Opt9Title    DB    '   Modify font text files    ',0
  140.  
  141. Opt9Text    DB    'For modifying banner font source files',29,1
  142.         DB    '1. Rotate a single output file 180 degrees',30,8,1
  143.         DB    '2. Rotate a single output file 90 degrees clockwise'
  144.         DB    29,1
  145.         DB    '3. Invert line order of a single file',30,13,1
  146.         DB    '4. Rotate full font 180 degrees',30,19,1
  147.         DB    '5. Rotate full font 90 degrees clockwise',30,10,1
  148.         DB    '6. Invert line order of a full font',30,7,1
  149.         DB    'Option or <Esc> to exit ?',0
  150.  
  151. InPromptDat    DB    'Input filename or <Return> to abort ?',0
  152.  
  153. OutPromptDat    DB    'Output filename or <Return> to abort ?',0
  154.  
  155. OvrWrtPrmptDat    DB    'The output file already exists',30,20
  156.         DB    'Do you wish to overwrite it ?',0
  157.  
  158. InEquOutDat    DB    'The Output filename must not be the same as the '
  159.         DB    'Input filename!',0
  160.  
  161. SetDef1Title    DB    '         Enter Title         ',0
  162. SetDef1Text    DB    'Is:',1,1,1,1,8
  163.         DB    'Enter a title or copyright notice for the font.  It'
  164.         DB    ' must',24,1
  165.         DB    'not exceed 70 characters.  Enter <Return> to keep '
  166.         DB    'the',27,1
  167.         DB    'existing title, if one exists.  Example:',29,1,1,11
  168.         DB    'Heron version 1.0 (C) 1985 Merlin R. Null'
  169.         DB    28,1,1,1,1,1
  170.         DB    'Title ?',0
  171.  
  172. SetDef2Title    DB    ' Enter Comments or Subtitle  ',0
  173. SetDef2Text    DB    'Is:',1,1,1,1,1,8
  174.         DB    'One additional line of comments or a font subtitle '
  175.         DB    'may be',23,1
  176.         DB    'entered.  Enter <Return> to retain existing comment '
  177.         DB    'line',24,1
  178.         DB    'or 999 to leave it blank.'
  179.         DB    30,1,1,1,1,1,1,1,14
  180.         DB    'Comment ?',0
  181.  
  182. SetDef3Title    DB    ' Set Default Print Character ',0
  183. SetDef3Text    DB    'Is:',1,1,1,30,21
  184.         DB    'The single character used by  FONTSY to print all '
  185.         DB    'large letters can',13,1
  186.         DB    'be set to any printable character.  Use a single '
  187.         DB    'keystroke OR enter',13,1
  188.         DB    'a minimum of two decimal numbers to use the ASCII '
  189.         DB    'value.   Example:',13,1
  190.         DB    'Character 239 on the Gemini-10X is a 6 by 6 graphic '
  191.         DB    'square.   Enter',13,1
  192.         DB    '255 to print each large character with its'
  193.         DB    ' own small character.',31,1
  194.         DB    '<Return> retains the current value',26,1,1
  195.         DB    'Character or decimal value ?',0
  196.  
  197. SetDef4Title    DB    '         Set Margin          ',0
  198. SetDef4Text    DB    'Is:',1,1,1,30,22
  199.         DB    'A margin may be set below the font by printing'
  200.         DB    ' the lowest',23,1
  201.         DB    'element of the font at some value other than'
  202.         DB    ' column 1.',31,1,1
  203.         DB    'Enter <Return>, to retain the current number.'
  204.         DB    20,1,1,1,1,1,1,1
  205.         DB    'Column to start printing ?',0
  206.  
  207. SetDef5Title    DB    '   Rows Between Characters   ',0
  208. SetDef5Text    DB    'Is:',30,1,1,1,1,1,17
  209.         DB    'The number of rows between large characters may be '
  210.         DB    'set from 0 to 99.',12,1
  211.         DB    'A value of 3 works well for most fonts.',30,23,1
  212.         DB    '<Return> retains the current value',29,1,1,1,1,1,1
  213.         DB    'Number of rows ?',0
  214.  
  215. SetDef6Title    DB    '   Printer Initialiaztion    ',0
  216. SetDef6Text    DB    'An initialization string may be optionally sent to '
  217.         DB    'the printer',18
  218.         DB    'to set pitch, linefeeds or other funtions.  This may'
  219.         DB    ' be set to',18
  220.         DB    'different values for each font.   Please consult '
  221.         DB    'your printer',19
  222.         DB    'manual for details.',0
  223.  
  224. PrnStringText    DB    'Enter each byte of the printer command string with '
  225.         DB    'the decimal value',12
  226.         DB    'of each character.  Terminate input with a bare '
  227.         DB    '<Return>.  Enter 999',12
  228.         DB    'to have no printer string sent.  A bare <Return> '
  229.         DB    'for the first byte',13
  230.         DB    'of the input causes the old string to be retained.',0
  231.  
  232. SetDef7Title    DB    '    Printer Reset String     ',0
  233. SetDef7Text    DB    'A printer reset string should be sent to set printer'
  234.         DB    ' back to',20
  235.         DB    'defaults.  It is preferable to reset all functions '
  236.         DB    'set with',21
  237.         DB    'the initialization string rather than use a command '
  238.         DB    'to reset',20
  239.         DB    'everything.',0
  240.  
  241. SetDef8Title    DB    '     Font  Magnification     ',0
  242. SetDef8Text    DB    'Multiply or divide the number of rows or columns'
  243.         DB    ' printed.  For new',14,1
  244.         DB    'fonts these are usually set to single.  Other values'
  245.         DB    ' are mostly used',12,1
  246.         DB    'at run time.  <Return> here accepts the displayed'
  247.         DB    ' values.',30,1,1
  248.         DB    '1  Change Horizontal size (rows)   is:',30,12,1,1
  249.         DB    '2  Change Vertical size (columns)  is:',29,1,1,1,1
  250.         DB    'Option or <Return> ?',0
  251.  
  252.  
  253. AbortText    DB    '*** ABORTING *** per operator request',0
  254.  
  255. HoldText    DB    '<Press any key to continue>',0
  256.  
  257. NoFilesText    DB    'No files found for',0
  258. NoFiles2Text    DB    'Filenames to be included should have the format:'
  259.         DB    30,2,1
  260.         DB    'Fontname + decimal number of the character to '
  261.         DB    'include.',26,1
  262.         DB    'Example:  KIWI.065 = the letter "A" for the font'
  263.         DB    30,2,1
  264.         DB    'Kiwi.  This is followed by KIWI.066, KIWI.067 etc.',0
  265.  
  266. ;-----------------------------------------------------------------------------
  267. DisplayTable    DB    2DH,29H            ;display re-enable values for
  268.                         ; modes 2 and 3
  269. AtrByte        DB    0
  270. ;-----------------------------------------------------------------------------
  271. DATA        ENDS
  272.  
  273. DGROUP        GROUP    DATA
  274.  
  275. CODE        SEGMENT    BYTE    PUBLIC    'CODE'
  276.         ASSUME    CS:CODE, DS:DGROUP
  277.  
  278.         PUBLIC    MenuScreen,Description,AvailChars,Opt1Prompt
  279.         PUBLIC    LoadingFont,Opt2Prompt,Opt2Screen
  280.         PUBLIC    Opt3Screen,Opt4Screen,Opt5Screen
  281.         PUBLIC    Opt6Screen,Opt6aScreen,Opt9Screen
  282.         PUBLIC    InFilePrompt,OutFilePrompt,OvrWrtPrmpt,InEquOut
  283.         PUBLIC    SetDef1Screen,SetDef2Screen,SetDef3Screen
  284.         PUBLIC    SetDef4Screen,SetDef5Screen,SetDef6Screen
  285.         PUBLIC    SetDef7Screen,SetDef8Screen,Hold,Abort,NoFiles
  286.         PUBLIC    WindowScroll,ClearToEOS
  287.  
  288. Main        PROC    FAR
  289.  
  290. MenuScreen:    PUSH    BP
  291.         MOV    BP,SP
  292.         CALL    ClrScr
  293.         MOV    AtrByte,YellowOnBlue
  294.         LEA    SI,TitleDat
  295.         XOR    DX,DX            ;row 0 column 0
  296.         CALL    IsrtStr
  297.         MOV    AtrByte,GreenOnBlack
  298.         LEA    SI,MenuText
  299.         MOV    DX,0301H        ;row 3 column 1
  300.         CALL    IsrtStr
  301.         POP    BP
  302.         RET
  303. ;-----------------------------------------------------------------------------
  304. Description:    PUSH    BP
  305.         MOV    BP,SP
  306.         MOV    AtrByte,GreenOnBlack
  307.         LEA    SI,DescText
  308.         MOV    DX,0905H        ;row 9 column 5
  309.         CALL    IsrtStr
  310.         POP    BP
  311.         RET
  312. ;-----------------------------------------------------------------------------
  313. AvailChars:    PUSH    BP
  314.         MOV    BP,SP
  315.         MOV    AtrByte,GreenOnBlack
  316.         LEA    SI,AvailText
  317.         MOV    DX,0815H        ;row 8 column 21
  318.         CALL    IsrtStr
  319.         POP    BP
  320.         RET
  321. ;-----------------------------------------------------------------------------
  322. Opt1Prompt:    PUSH    BP
  323.         MOV    BP,SP
  324.         CALL    ClearPrompt
  325.         MOV    AtrByte,CyanOnBlack
  326.         LEA    SI,Opt1Text
  327.         MOV    DX,1700H        ;row 23 column 0
  328.         CALL    IsrtStr
  329.         POP    BP
  330.         RET
  331. ;-----------------------------------------------------------------------------
  332. LoadingFont:    PUSH    BP
  333.         MOV    BP,SP
  334.         MOV    AtrByte,WhiteOnRed
  335.         LEA    SI,Opt1aText
  336.         MOV    DX,0D10H        ;row 13 column 16
  337.         CALL    IsrtStr
  338.         POP    BP
  339.         RET
  340. ;-----------------------------------------------------------------------------
  341. Opt2Prompt:    PUSH    BP
  342.         MOV    BP,SP
  343.         CALL    ClearPrompt
  344.         MOV    AtrByte,CyanOnBlack
  345.         LEA    SI,Opt2Text
  346.         MOV    DX,1700H        ;row 23 column 0
  347.         CALL    IsrtStr
  348.         POP    BP
  349.         RET
  350. ;-----------------------------------------------------------------------------
  351. Opt2Screen:    PUSH    BP
  352.         MOV    BP,SP
  353.         CALL    ClrScr
  354.         MOV    AtrByte,CyanOnGreen
  355.         LEA    SI,Opt2Title
  356.         MOV    DX,000EH        ;row 0 column 14
  357.         CALL    IsrtStr
  358.         MOV    AtrByte,GreenOnBlack
  359.         LEA    SI,Opt2aText
  360.         MOV    DX,0914H        ;row 9 column 20
  361.         CALL    IsrtStr
  362.         POP    BP
  363.         RET
  364. ;-----------------------------------------------------------------------------
  365. Opt3Screen:    PUSH    BP
  366.         MOV    BP,SP
  367.         MOV    AtrByte,YellowOnCyan
  368.         CALL    FRAME
  369.         LEA    SI,Opt3Title
  370.         MOV    DX,0119H        ;row 1 column 25
  371.         CALL    IsrtStr
  372.         MOV    AtrByte,GreenOnBlack
  373.         LEA    SI,Opt3Text
  374.         MOV    DX,0808H        ;row 8 column 8
  375.         CALL    IsrtStr
  376.         POP    BP
  377.         RET
  378. ;-----------------------------------------------------------------------------
  379. Opt4Screen:    PUSH    BP
  380.         MOV    BP,SP
  381.         MOV    AtrByte,YellowOnRed
  382.         CALL    FRAME
  383.         LEA    SI,Opt4Title
  384.         MOV    DX,0119H        ;row 1 column 25
  385.         CALL    IsrtStr
  386.         MOV    AtrByte,GreenOnBlack
  387.         LEA    SI,Opt4Text
  388.         MOV    DX,0405H        ;row 04 column 5
  389.         CALL    IsrtStr
  390.         POP    BP
  391.         RET
  392. ;-----------------------------------------------------------------------------
  393. Opt5Screen:    PUSH    BP
  394.         MOV    BP,SP
  395.         MOV    AtrByte,YellowOnMagenta
  396.         CALL    FRAME
  397.         LEA    SI,Opt5Title
  398.         MOV    DX,0119H        ;row 1 column 25
  399.         CALL    IsrtStr
  400.         MOV    AtrByte,GreenOnBlack
  401.         LEA    SI,Opt5Text
  402.         MOV    DX,0408H        ;row 4 column 8
  403.         CALL    IsrtStr
  404.         POP    BP
  405.         RET
  406. ;-----------------------------------------------------------------------------
  407. Opt6Screen:    PUSH    BP
  408.         MOV    BP,SP
  409.         MOV    AtrByte,YellowOnBrown
  410.         CALL    FRAME
  411.         LEA    SI,Opt6Title
  412.         MOV    DX,0119H        ;row 1 column 25
  413.         CALL    IsrtStr
  414.         MOV    AtrByte,GreenOnBlack
  415.         LEA    SI,Opt6Text
  416.         MOV    DX,0518H        ;row 5 column 24
  417.         CALL    IsrtStr
  418.         POP    BP
  419.         RET
  420. ;-----------------------------------------------------------------------------
  421. Opt6aScreen:    PUSH    BP
  422.         MOV    BP,SP
  423.         LEA    SI,Opt6aText
  424.         MOV    DX,0C19H        ;row 12 column 25
  425.         CALL    IsrtStr
  426.         POP    BP
  427.         RET
  428. ;-----------------------------------------------------------------------------
  429. Opt9Screen:    PUSH    BP
  430.         MOV    BP,SP
  431.         CALL    ClrScr
  432.         MOV    AtrByte,YellowOnBlue
  433.         CALL    Frame
  434.         LEA    SI,Opt9Title
  435.         MOV    DX,0119H        ;row 1 column 25
  436.         CALL    IsrtStr
  437.         MOV    AtrByte,GreenOnBlack
  438.         LEA    SI,Opt9Text
  439.         MOV    DX,0315H        ;row 3 column 21
  440.         CALL    IsrtStr
  441.         POP    BP
  442.         RET
  443. ;--------------------------------------------------------------------
  444. InFilePrompt:    PUSH    BP
  445.         MOV    BP,SP
  446.         LEA    SI,InPromptDat
  447.         MOV    DX,1300H        ;row 19 column 0
  448.         CALL    IsrtStr
  449.         POP    BP
  450.         RET
  451. ;--------------------------------------------------------------------
  452. OutFilePrompt:    PUSH    BP
  453.         MOV    BP,SP
  454.         LEA    SI,OutPromptDat
  455.         MOV    DX,1500H        ;row 21 column 0
  456.         CALL    IsrtStr
  457.         POP    BP
  458.         RET
  459. ;--------------------------------------------------------------------
  460. OvrWrtPrmpt:    PUSH    BP
  461.         MOV    BP,SP
  462.         MOV    AtrByte,RedOnBlack
  463.         LEA    SI,OvrWrtPrmptDat
  464.         MOV    DX,1600H        ;row 22 column 0
  465.         CALL    IsrtStr
  466.         MOV    AtrByte,GreenOnBlack
  467.         POP    BP
  468.         RET
  469. ;--------------------------------------------------------------------
  470. InEquOut:    PUSH    BP
  471.         MOV    BP,SP
  472.         MOV    AtrByte,RedOnBlack
  473.         LEA    SI,InEquOutDat
  474.         MOV    DX,1600H        ;row 22 column 0
  475.         CALL    IsrtStr
  476.         MOV    AtrByte,GreenOnBlack
  477.         POP    BP
  478.         RET
  479. ;-----------------------------------------------------------------------------
  480. ;Set Font Title Screen
  481.  
  482. SetDef1Screen:    PUSH    BP
  483.         MOV    BP,SP
  484.         MOV    AtrByte,WhiteOnBlue
  485.         CALL    FRAME
  486.         LEA    SI,SetDef1Title
  487.         MOV    DX,0119H        ;row 1 column 25
  488.         CALL    IsrtStr
  489.         MOV    AtrByte,GreenOnBlack
  490.         LEA    SI,SetDef1Text
  491.         MOV    DX,0600H        ;row 6 column 0
  492.         CALL    IsrtStr
  493.         POP    BP
  494.         RET
  495. ;-----------------------------------------------------------------------------
  496. ;Enter Comments Screen
  497.  
  498. SetDef2Screen:    PUSH    BP
  499.         MOV    BP,SP
  500.         MOV    AtrByte,WhiteOnGreen
  501.         CALL    FRAME
  502.         LEA    SI,SetDef2Title
  503.         MOV    DX,0119H        ;row 1 column 25
  504.         CALL    IsrtStr
  505.         MOV    AtrByte,GreenOnBlack
  506.         LEA    SI,SetDef2Text
  507.         MOV    DX,0600H        ;row 6 column 0
  508.         CALL    IsrtStr
  509.         POP    BP
  510.         RET
  511. ;-----------------------------------------------------------------------------
  512. SetDef3Screen:    PUSH    BP
  513.         MOV    BP,SP
  514.         MOV    AtrByte,WhiteOnCyan
  515.         CALL    FRAME
  516.         LEA    SI,SetDef3Title
  517.         MOV    DX,0119H        ;row 1 column 25
  518.         CALL    IsrtStr
  519.         MOV    AtrByte,GreenOnBlack
  520.         LEA    SI,SetDef3Text
  521.         MOV    DX,0621H        ;row 6 column 33
  522.         CALL    IsrtStr
  523.         POP    BP
  524.         RET
  525. ;-----------------------------------------------------------------------------
  526. SetDef4Screen:    PUSH    BP
  527.         MOV    BP,SP
  528.         MOV    AtrByte,WhiteOnRed
  529.         CALL    FRAME
  530.         LEA    SI,SetDef4Title
  531.         MOV    DX,0119H        ;row 1 column 25
  532.         CALL    IsrtStr
  533.         MOV    AtrByte,GreenOnBlack
  534.         LEA    SI,SetDef4Text
  535.         MOV    DX,0623H        ;row 6 column 35
  536.         CALL    IsrtStr
  537.         POP    BP
  538.         RET
  539. ;-----------------------------------------------------------------------------
  540. SetDef5Screen:    PUSH    BP
  541.         MOV    BP,SP
  542.         MOV    AtrByte,WhiteOnMagenta
  543.         CALL    FRAME
  544.         LEA    SI,SetDef5Title
  545.         MOV    DX,0119H        ;row 1 column 25
  546.         CALL    IsrtStr
  547.         MOV    AtrByte,GreenOnBlack
  548.         LEA    SI,SetDef5Text
  549.         MOV    DX,0623H        ;row 6 column 35
  550.         CALL    IsrtStr
  551.         POP    BP
  552.         RET
  553. ;-----------------------------------------------------------------------------
  554. SetDef6Screen:    PUSH    BP
  555.         MOV    BP,SP
  556.         MOV    AtrByte,WhiteOnBrown
  557.         CALL    FRAME
  558.         LEA    SI,SetDef6Title
  559.         MOV    DX,0119H        ;row 1 column 25
  560.         CALL    IsrtStr
  561.         MOV    AtrByte,GreenOnBlack
  562.         LEA    SI,SetDef6Text
  563.         MOV    DX,0406H        ;row 4 column 6
  564.         CALL    IsrtStr
  565.         LEA    SI,PrnStringText
  566.         MOV    DX,0906H        ;row 9 column 6
  567.         CALL    IsrtStr
  568.         POP    BP
  569.         RET
  570. ;-----------------------------------------------------------------------------
  571. SetDef7Screen:    PUSH    BP
  572.         MOV    BP,SP
  573.         MOV    AtrByte,CyanOnMagenta
  574.         CALL    FRAME
  575.         LEA    SI,SetDef7Title
  576.         MOV    DX,0119H        ;row 1 column 25
  577.         CALL    IsrtStr
  578.         MOV    AtrByte,GreenOnBlack
  579.         LEA    SI,SetDef7Text
  580.         MOV    DX,0406H        ;row 4 column 6
  581.         CALL    IsrtStr
  582.         LEA    SI,PrnStringText
  583.         MOV    DX,0906H        ;row 9 column 6
  584.         CALL    IsrtStr
  585.         POP    BP
  586.         RET
  587. ;-----------------------------------------------------------------------------
  588. SetDef8Screen:    PUSH    BP
  589.         MOV    BP,SP
  590.         MOV    AtrByte,WhiteOnBlue  
  591.         CALL    FRAME
  592.         LEA    SI,SetDef8Title
  593.         MOV    DX,0119H        ;row 1 column 25
  594.         CALL    IsrtStr
  595.         MOV    AtrByte,GreenOnBlack
  596.         LEA    SI,SetDef8Text
  597.         MOV    DX,0806H        ;row 8 column 6
  598.         CALL    IsrtStr
  599.         POP    BP
  600.         RET
  601. ;-----------------------------------------------------------------------------
  602. Abort:        PUSH    BP
  603.         MOV    BP,SP
  604.         MOV    AtrByte,CyanOnBlack
  605.         LEA    SI,AbortText
  606.         MOV    DX,1515H        ;row 21 column 21
  607.         CALL    IsrtStr
  608.         POP    BP
  609.         RET
  610. ;-----------------------------------------------------------------------------
  611. Hold:        PUSH    BP
  612.         MOV    BP,SP
  613.         CALL    ClearPrompt
  614.         MOV    AtrByte,CyanOnBlack
  615.         LEA    SI,HoldText
  616.         MOV    DX,1719H        ;row 23 column 25
  617.         CALL    IsrtStr
  618.         CALL    GetMode            ;get crt mode
  619.         CMP    AL,7            ;is it monochrome
  620.         JNE    ColorCursor
  621.         MOV    CX,0C0DH        ;cursor lines 12 & 13
  622.         MOV    AH,1            ;set cursor type function
  623.         INT    10H
  624.         JMP    SHORT Hold2
  625.  
  626. ColorCursor:    MOV    CX,0607H        ;cursor lines 6 & 7
  627.         MOV    AH,1            ;set cursor type function
  628.         INT    10H
  629. Hold2:        MOV    DX,1735H        ;row 23 column 53
  630.         CALL    Locate            ;move cursor
  631.         XOR    AH,AH            ;get a keypress
  632.         INT    16H            ;BIOS keyboard input
  633.         POP    BP
  634.         RET
  635. ;-----------------------------------------------------------------------------
  636. NoFiles:    PUSH    BP
  637.         MOV    BP,SP
  638.         CALL    ClrScr
  639.         MOV    AtrByte,RedOnBlack
  640.         LEA    SI,NoFilesText
  641.         MOV    DX,0313H        ;row 3 column 19
  642.         CALL    IsrtStr
  643.         MOV    AtrByte,GreenOnBlack
  644.         LEA    SI,NoFiles2Text
  645.         MOV    DX,070BH        ;row 7 column 11
  646.         CALL    IsrtStr
  647.         POP    BP
  648.         RET
  649. ;-----------------------------------------------------------------------------
  650. ;Clear To End Of Screen  Pass starting line of clear (0-23) in
  651. ; variable StartLine
  652.  
  653. ClearToEOS:    PUSH    BP
  654.         MOV    BP,SP
  655.         MOV    BX,[BP]+6
  656.         MOV    CH,[BX]        ;get start row
  657.         XOR    CL,CL        ;column 0
  658.         MOV    DX,174FH    ;lower right row 23 col 79
  659.         MOV    BH,7        ;normal screen attribute
  660.         MOV    AX,0600H    ;scroll active page
  661.         INT    10H        ;call BIOS
  662.         POP    BP
  663.         RET    2
  664. ;--------------------------------------------------------------------
  665. ;Scroll Window area. Called from BASIC with ULCorner which is put
  666. ;in CX and LRCorner to DX
  667.  
  668. WindowScroll:    PUSH    BP
  669.         MOV    BP,SP
  670.         MOV    BX,[BP]+8    ;upper left
  671.         MOV    CX,[BX]
  672.         MOV    BX,[BP]+6    ;lower right
  673.         MOV    DX,[BX]
  674.         MOV    BH,7        ;normal screen attribute
  675.         MOV    AX,0601H    ;scroll active window 1 line
  676.         INT    10H        ;call BIOS
  677.         POP    BP
  678.         RET    4
  679.  
  680. Main        ENDP
  681. ;*****************************************************************************
  682. ;************ Start of Routines Local to the Assembly Module *****************
  683. ;*****************************************************************************
  684. Frame        PROC    NEAR
  685.         CALL    ClrScr
  686.         LEA    SI,FrameDat
  687.         MOV    DX,0016H        ;row 0 column 22
  688.         CALL    IsrtStr
  689.         RET
  690. Frame        ENDP
  691. ;-----------------------------------------------------------------------------
  692. ;Clear 24th Line (Prompt)
  693.  
  694. ClearPrompt    PROC    NEAR
  695.         MOV    CX,1700H        ;upper left (23,0)
  696.         MOV    DX,174FH        ;lower right (23,79)
  697.         MOV    BH,7            ;normal screen attribute
  698.         MOV    AX,0600H        ;scroll active page
  699.         INT    10H            ;call BIOS
  700.         RET
  701. ClearPrompt    ENDP
  702. ;-----------------------------------------------------------------------------
  703. ;Clear the Screen and Home
  704.  
  705. ClrScr        PROC    NEAR
  706.         XOR    CX,CX            ;upper left (0,0)
  707.         MOV    DX,184FH        ;lower right (24,79)
  708.         MOV    BH,7            ;normal screen attribute
  709.         MOV    AX,0600H        ;scroll active page
  710.         INT    10H            ;call BIOS
  711.         XOR    DX,DX            ;row 0, column 0
  712.                         ;fall through to LOCATE
  713. ;-----------------------------------------------------------------------------
  714. ;Direct Cursor Addressing
  715. ;    DX  row, column
  716.  
  717. Locate:        MOV    AH,2            ;request move cursor
  718.         XOR    BH,BH            ;page #0
  719.         INT    10H            ;call BIOS
  720.         RET
  721. ClrScr        ENDP
  722. ;-----------------------------------------------------------------------------
  723. ;Insert String Directly in the Video Buffer
  724. ;    SI string address    DX row, column
  725. ;    AtrByte holds color, foreground and background
  726.  
  727. IsrtStr        PROC    NEAR
  728.         PUSH    ES
  729.     IF    NoSnow
  730.         CALL    VideoDisable        ;turn display off for
  731.                         ; snow-free writing
  732.     ENDIF
  733.         CALL    CalcVidOffset        ;calc offset into video buffer
  734.         MOV    DI,AX            ;offset was returned in AX
  735.         MOV    DH,AtrByte        ;get the attribute byte
  736.         CALL    SetVidAddr        ;set to monochrome or graphics
  737.         MOV    ES,AX            ;video buffer address into ES
  738.  
  739. IsrtLoop:    MOV    DL,BYTE PTR[SI]
  740.         CMP    DL,0
  741.         JE    IsrtStrExit        ;exit if end of string
  742.         CMP    DL,31            ;control character?
  743.         JA    IsrtWord        ;no, use the character
  744.         CMP    DL,1            ;if character 1
  745.         JZ    Skip80            ;skip next 80 print positions
  746.         XOR    DH,DH            ;zero attribute byte
  747.         SHL    DX,1            ;skip number of print
  748.         ADD    DI,DX            ;positions = ASCII value
  749.         MOV    DH,AtrByte        ;restore attribute byte
  750.         JMP    SHORT NextByte
  751.  
  752. Skip80:    ADD    DI,0A0H                ;skip next 80 positions
  753.         JMP    SHORT NextByte
  754.  
  755. IsrtWord:    MOV    ES:WORD PTR[DI],DX    ;move char and attr to crt buf
  756.  
  757.         ADD    DI,2            ;point to next crt buf loc
  758. NextByte:    ADD    SI,1            ;point to next string byte
  759.         JMP    SHORT IsrtLoop        ;move another word
  760.  
  761. IsrtStrExit:
  762.     IF    NoSnow
  763.         CALL    VideoEnable        ;video back on if CGA
  764.     ENDIF
  765.         POP    ES
  766.         RET
  767. IsrtStr        ENDP
  768. ;-----------------------------------------------------------------------------
  769. ;Set Video Address
  770.  
  771. SetVidAddr    PROC    NEAR
  772.         CALL    GetMode            ;get crt mode
  773.         CMP    AL,7            ;is it monochrome
  774.         JNE    ItsGraphics
  775.         MOV    AX,MonoSegAddr        ;monochrome buffer seg addr
  776.         RET
  777.  
  778. ItsGraphics:    MOV    AX,GraphSegAddr        ;graphics buffer seg address
  779.         RET
  780. SetVidAddr    ENDP
  781. ;-----------------------------------------------------------------------------
  782. ;Calculate Video Address
  783.  
  784. CalcVidOffset    PROC    NEAR
  785.         MOV    AX,160            ;number of bytes in row
  786.         MUL    DH            ;row * 160
  787.         SHL    DL,1            ;column * 2
  788.         XOR    DH,DH            ;byte to word
  789.         ADD    AX,DX            ;(row *160)+(column*2)
  790.         MOV    DI,AX            ;set offset in DI
  791.         RET
  792. CalcVidOffset    ENDP
  793. ;-----------------------------------------------------------------------------
  794. ;Get Video Mode.
  795. ;Returns CRT mode in AL and the number of character columns on the
  796. ;screen in AH.
  797.  
  798. GetMode        PROC    NEAR
  799.         MOV    AX,0F00H
  800.         INT    10H
  801.         RET
  802. GetMode        ENDP
  803. ;-----------------------------------------------------------------------------
  804. ;VideoEnable and VideoDisable routines manipulate bit 3 of port 3D8h,
  805. ;the CGA Mode Control Register, to temporarily turn the display on or off.
  806. ;These routines write directly to hardware, and have no effect on other
  807. ;video adapters.
  808.  
  809.     IF    NoSnow
  810. VideoDisable    PROC    NEAR
  811.         PUSH    DX
  812.         CALL    GetMode            ;get crt mode
  813.         CMP    AL,7            ;is it monochrome
  814.         JE    Disable2
  815.         MOV    DX,3DAH            ;read CGA status port
  816. Disable1:    IN    AL,DX            ;wait for vertical retrace to
  817.                         ;occur
  818.         TEST    AL,8            ;is bit 3 set?
  819.         JE    Disable1        ;no, wait until it is
  820.         MOV    DX,3D8H            ;now disable the display
  821.         MOV    AL,25H            ;by clearing bit 3 of the Mode
  822.                         ; Control Register
  823.         OUT    DX,AL
  824. Disable2:    POP    DX
  825.         RET
  826. VideoDisable    ENDP
  827. ;-----------------------------------------------------------------------------
  828. VideoEnable    PROC    NEAR
  829.         CALL    GetMode            ;get crt mode
  830.         CMP    AL,7            ;is it monochrome
  831.         JE    Enable2
  832.         XOR    AH,AH            ;eliminate columns info
  833.         MOV    DX,3D8H            ;CGA Mode Control Register
  834.         MOV    BX,AX            ;video mode to BX
  835.         SUB    BX,2
  836.         MOV    AL,DisplayTable[BX]
  837.         OUT    DX,AL            ;and send it to the port
  838. Enable2:    RET
  839. VideoEnable    ENDP
  840.     ENDIF
  841. ;-----------------------------------------------------------------------------
  842. CODE        ENDS
  843.         END
  844.